#include <func.h>

int main()
{
    //ipv4,tcp,自由选择（0）
    int client_fd=socket(AF_INET,SOCK_STREAM,0);
    ERROR_CHECK(client_fd,-1,"socket");

    //
    struct sockaddr_in serAddr;
    memset(&serAddr,0,sizeof(serAddr));
    serAddr.sin_family=AF_INET;
    serAddr.sin_addr.s_addr=inet_addr("192.168.176.128");
    serAddr.sin_port=htons(2000);

    int ret=connect(client_fd,(struct sockaddr*)&serAddr,sizeof(serAddr));
    ERROR_CHECK(ret,-1,"connect");
    send(client_fd,"hello",5,0);

    char buf[1000]={0};
    recv(client_fd,buf,sizeof(buf),0);
    printf("client gets=%s\n",buf);
    close(client_fd);
    return 0;
}